Fix NonDaemonThreads flush race causing MessageData loss on Java 21 OpenJ9#4759
Draft
Copilot wants to merge 2 commits into
Draft
Fix NonDaemonThreads flush race causing MessageData loss on Java 21 OpenJ9#4759Copilot wants to merge 2 commits into
Copilot wants to merge 2 commits into
Conversation
…tdown() and InterruptedException handling Co-authored-by: johnoliver <1615532+johnoliver@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix failing GitHub Actions job NonDaemonThreads:NonDaemonThreadsTest
Fix NonDaemonThreads flush race causing MessageData loss on Java 21 OpenJ9
Jun 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
NonDaemonThreadsTest$Java21OpenJ9Testwas timing out waiting forMessageDatabecause the "done" log record was never exported before the process exited.Root cause
SecondEntryPoint.flushAll()chainedtelemetryClient.forceFlush()inside an asyncwhenComplete()callback onsdk.shutdown(). On Java 21 OpenJ9, the OTel SDK'sBatchLogRecordProcessordaemon thread could stall during shutdown, leaving the result code unresolved. With no callback ever firing,telemetryClient.forceFlush()was never called. The 10-secondjoin()timeout expired, the shutdown hook thread exited, daemon threads were killed, and the buffered log was lost.A secondary issue in
BatchItemProcessor: if the daemon worker was interrupted duringsignal.poll(), it exited silently while leavingflushRequestedunresolved — causingforceFlush()callers to block until the outer timeout.Changes
SecondEntryPoint.flushAll()— replace the async callback chain with a synchronous bounded wait + unconditional flush:BatchItemProcessorworkerInterruptedExceptionhandler — fail any pendingflushRequestedresult code before returning, so callers are unblocked immediately rather than hanging until the outer timeout.